package com.vo;

import com.bean.Movie;

import java.io.Serializable;
import java.text.ParseException;
import java.text.SimpleDateFormat;

public class MovieVo implements Serializable {
    private String id;
    private String movieName;
    private String director;
    private String performer;
    private String type;
    private String language;
    private String showTime;
    private String duration;
    private String Image;
    private String score;
    private String brief;
    private String region;
    private String state;
    private String spare;

    public Movie parse(){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Movie m=new Movie();
        try {
            m.setId(Integer.valueOf(this.id));
        } catch (NumberFormatException e) {
        }
        try {
            m.setShowTime(simpleDateFormat.parse(this.showTime));
        } catch (ParseException e) {
        }
        try {
            m.setDuration(Integer.valueOf(this.duration));
        } catch (NumberFormatException e) {
        }
        try {
            m.setScore(Double.parseDouble(this.score));
        } catch (NumberFormatException e) {
        }
        try {
            m.setState(Integer.valueOf(this.state));
        } catch (NumberFormatException e) {
        }
        try {
            m.setSpare(Integer.valueOf(this.spare));
        } catch (NumberFormatException e) {
        }
        m.setMovieName(this.movieName);
        m.setDirector(this.director);
        m.setPerformer(this.performer);
        m.setType(this.type);
        m.setLanguage(this.language);
        m.setImage(Image);
        m.setBrief(this.brief);
        m.setRegion(this.region);

        return m;
    }

    @Override
    public String toString() {
        return "MovieVo{" +
                "id='" + id + '\'' +
                ", movieName='" + movieName + '\'' +
                ", director='" + director + '\'' +
                ", performer='" + performer + '\'' +
                ", type='" + type + '\'' +
                ", language='" + language + '\'' +
                ", showTime='" + showTime + '\'' +
                ", duration='" + duration + '\'' +
                ", Image='" + Image + '\'' +
                ", score='" + score + '\'' +
                ", brief='" + brief + '\'' +
                ", region='" + region + '\'' +
                ", state='" + state + '\'' +
                ", spare='" + spare + '\'' +
                '}';
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getMovieName() {
        return movieName;
    }

    public void setMovieName(String movieName) {
        this.movieName = movieName;
    }

    public String getDirector() {
        return director;
    }

    public void setDirector(String director) {
        this.director = director;
    }

    public String getPerformer() {
        return performer;
    }

    public void setPerformer(String performer) {
        this.performer = performer;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getLanguage() {
        return language;
    }

    public void setLanguage(String language) {
        this.language = language;
    }

    public String getShowTime() {
        return showTime;
    }

    public void setShowTime(String showTime) {
        this.showTime = showTime;
    }

    public String getDuration() {
        return duration;
    }

    public void setDuration(String duration) {
        this.duration = duration;
    }

    public String getImage() {
        return Image;
    }

    public void setImage(String image) {
        Image = image;
    }

    public String getScore() {
        return score;
    }

    public void setScore(String score) {
        this.score = score;
    }

    public String getBrief() {
        return brief;
    }

    public void setBrief(String brief) {
        this.brief = brief;
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getSpare() {
        return spare;
    }

    public void setSpare(String spare) {
        this.spare = spare;
    }
}
